package net.hn.hnms.biz.cockpit.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import net.hn.hnms.biz.api.video.RemoteVideoService;
import net.hn.hnms.biz.cockpit.domain.VideoConfig;
import net.hn.hnms.biz.cockpit.mapper.VideoConfigMapper;
import net.hn.hnms.biz.cockpit.service.IVideoConfigService;
import net.hn.hnms.sys.common.core.domain.R;
import org.springframework.stereotype.Service;

@Service
public class VideoConfigServiceImpl extends ServiceImpl<VideoConfigMapper, VideoConfig> implements IVideoConfigService {

    private final RemoteVideoService remoteVideoService;

    public VideoConfigServiceImpl(RemoteVideoService remoteVideoService) {
        this.remoteVideoService = remoteVideoService;
    }

    @Override
    public String getCameraStreamUrl(String cameraCode) {
        String url = "";
        R<String> hls = remoteVideoService.getStreamUrl(cameraCode, "0", "hls", null, null, "transcode=1&videotype=h264");
        if (hls.getCode() == 200) {
            url = hls.getData();
        }
        return url;
    }


}
